package com.qf.controller;


import com.qf.entity.CouponTemplate;
import com.qf.entity.R;
import com.qf.service.CouponTemplateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * (CouponTemplate)表控制层
 *
 * @author makejava
 * @since 2020-10-14 14:33:33
 */
@RestController
@RequestMapping("/couponTemplate")
public class CouponTemplateController {
    /**
     * 服务对象
     */
    @Autowired
    private CouponTemplateService couponTemplateService;

    /**
     * 查询模板列表
     * @return
     */
    @RequestMapping("/list")
    public R<List<CouponTemplate>> list(){
        List<CouponTemplate> couponTemplates = couponTemplateService.list();
        return new R<List<CouponTemplate>>().setData(couponTemplates);
    }

    /**
     * 保存模板
     * @param couponTemplate
     * @return
     */
    @RequestMapping("/save")
    public R<Boolean> save(@RequestBody CouponTemplate couponTemplate){
        boolean flag = couponTemplateService.save(couponTemplate);
        return new R<Boolean>().setData(flag);
    }

}